package cn.edu.zafu.bigdata.x.huangxihao202211080211;

import java.util.concurrent.CancellationException;

class Vehicle{
    public void move(){
        System.out.println("Vehicle is moveing");
    }
}

class Car extends Vehicle{
    @Override
    public void move(){
        System.out.println("Car is moving");
    }
}

class Bicycle extends Vehicle{
    @Override
    public void move(){
        System.out.println("Bicycle is moving");
    }
}

public class Polymorphism {
    public static void main(String[] args){
        Vehicle[] vehicles=new Vehicle[2];
        vehicles[0]=new Car();
        vehicles[1]=new Bicycle();
        for (Vehicle v : vehicles){
            v.move();
        }
    }
}
